package com.toggery.POS.dao;

import com.toggery.POS.entity.Clothing;
import com.toggery.POS.entity.ClothingExample;
import com.toggery.POS.entity.ClothingRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClothingMapper {
    long countByExample(ClothingExample example);

    int deleteByExample(ClothingExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Clothing record);

    int insertSelective(Clothing record);

    List<Clothing> selectByExample(ClothingExample example);

    Clothing selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Clothing record, @Param("example") ClothingExample example);

    int updateByExample(@Param("record") Clothing record, @Param("example") ClothingExample example);

    int updateByPrimaryKeySelective(Clothing record);

    int updateByPrimaryKey(Clothing record);


    @Select({
            "select * from Clothing"
    })
    List<Clothing> findAll();


    @Select({
            "select * from Clothing where clothingname=#{clothingname,jdbcType=VARCHAR} limit 1"
    })
    Clothing findByName(String name);

    @Select({
            "select * from Clothing where clothingname like #{clothingname,jdbcType=VARCHAR}"
    })
    List<Clothing> findLikeName(String name);

    @Select({
            "select * from Clothing where brand =#{brand,jdbcType=INTEGER}"
    })
    List<Clothing> findByBrand(String name);
    @Select({
            "select * from Clothing where category =#{category,jdbcType=INTEGER}"
    })
    List<Clothing> findByCategory(String name);

    List<ClothingRecord> queryForList();
}